baubs git
Commit 7c3f79ae7e650afb91efa82d004cbfa04424f3c0
Parents : edb8fa9
Author : Jan-Henrik Bruhn <jan-henrik.bruhn@offis.de>
Date : 2025-12-28T09:00:03+01:00
fix: TypeScript error in InfoCard icon variant check
Fix TypeScript build error "Type 'null' cannot be used as an index type"
by adding explicit null check for variant before indexing defaultIcons.
The variant from VariantProps can be null even with a default value,
so TypeScript requires an explicit check.
Changes:
- Added null check: showDefaultIcon && variant
- Added 'as const' to defaultIcons for better type inference
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Changes
Diff
diff --git a/src/components/InfoCard.tsx b/src/components/InfoCard.tsx
index 2ba19d0..40c33d0 100644
--- a/src/components/InfoCard.tsx
+++ b/src/components/InfoCard.tsx
@@ -103,9 +103,10 @@ function InfoCard({
warning: ExclamationTriangleIcon,
error: ExclamationTriangleIcon,
success: CheckCircleIcon,
- };
+ } as const;
- const Icon = CustomIcon || (showDefaultIcon ? defaultIcons[variant] : null);
+ const Icon =
+ CustomIcon || (showDefaultIcon && variant ? defaultIcons[variant] : null);
return (
<div className={cn(infoCardVariants({ variant }), className)} {...props}>
Served by rngit 1.3.3 - Generated in 0.03s